import { createRouter, createWebHashHistory } from 'vue-router'

const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    { path: '/login', component: () => import('@/views/login/index.vue') },
    {
      path: '/word/detail/:id',
      component: () => import('@/views/worddetail/index.vue')
    },
    {
      path: '/',
      component: () => import('@/views/layout/index.vue'),
      redirect: '/word',
      children: [
        //背单词页
        {
          path: '/word',
          component: () => import('@/views/layout/WriteWord.vue')
        },
        //已背单词页面
        {
          path: '/sayword',
          component: () => import('@/views/layout/IsWriteWord.vue')
        },
        //在线考试页面
        {
          path: '/testpaper',
          component: () => import('@/views/testpaper/Index.vue')
        },
        //考试详情页面
        {
          path: '/testpaper/detail',
          component: () => import('@/views/testpaper/TestDetails.vue')
        },
        //图形分析索引页
        {
          path: '/stat',
          component: () => import('@/views/stat/Index.vue'),
          redirect: '/stat/forget',
          children: [
            //遗忘曲线页
            {
              path: '/stat/forget',
              component: () => import('@/views/stat/ForgetStat.vue')
            },
            //学习情况
            {
              path: '/stat/study',
              component: () => import('@/views/stat/StudyStatus.vue')
            },
            //学习时间段
            {
              path: '/stat/time',
              component: () => import('@/views/stat/StudyTime.vue')
            }
          ]
        },

        // 所有单词
        {
          path: '/list',
          component: () => import('@/views/layout/AllWord.vue')
        },
        //我的页面
        {
          path: '/my',
          component: () => import('@/views/user/index.vue')
        }
      ]
    }
  ]
})

export default router
